package com.sxhuayuan.parking.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;

import com.sxhuayuan.parking.config.CarActType;
import com.sxhuayuan.parking.config.Platform;

/**
 * 车辆入场记录，只保存场内的记录，已出场的保存到InOut表中
 */
@Entity
@Table(name = "hypk_parking_in")
public class ParkingIn extends BaseEntity {

	private static final long serialVersionUID = 8071829536983150499L;

	public static final String QUEUE_NAME = "parkingInQueue";
	// 车牌
	private String carPlate;
	// 卡号，openid，等
	private String cardNo;
	// 入场时间
	private Date inTime;

	/** 入场唯一标识，全局唯一 */
	private Long uniqueId;

	/** 第3方车场入场编号 */
	private String lotRecordId;

	/** 入口id */
	private Long entranceId;

	// 车场id
	private Long parkingLotId;
	// 上次缴费时间
	private Date lastChargeTime;
	// 使用的平台
	private Platform platform;
	// 免费时长，分钟
	private Integer freeMinutes;
	// 会员id，可为空
	private Long memberId;

	// 车辆操作类型 临时 长期/包月 免费
	private CarActType carActType = CarActType.temporary;

	@Column(length = 32, nullable = false)
	public String getCarPlate() {
		return carPlate;
	}

	public void setCarPlate(String carPlate) {
		this.carPlate = carPlate;
	}

	@Column(nullable = false)
	public Date getInTime() {
		return inTime;
	}

	public void setInTime(Date inTime) {
		this.inTime = inTime;
	}

	// @ManyToOne(fetch = FetchType.LAZY)
	// public ParkingLot getParkingLot() {
	// return parkingLot;
	// }
	//
	// public void setParkingLot(ParkingLot parkingLot) {
	// this.parkingLot = parkingLot;
	// }
	@Column(nullable = false)
	public Long getParkingLotId() {
		return parkingLotId;
	}

	public void setParkingLotId(Long parkingLotId) {
		this.parkingLotId = parkingLotId;
	}

	@Column(nullable = false)
	public Long getUniqueId() {
		return uniqueId;
	}

	public void setUniqueId(Long uniqueId) {
		this.uniqueId = uniqueId;
	}

	public Long getEntranceId() {
		return entranceId;
	}

	public void setEntranceId(Long entranceId) {
		this.entranceId = entranceId;
	}

	@Column(length = 64)
	public String getCardNo() {
		return cardNo;
	}

	public void setCardNo(String cardNo) {
		this.cardNo = cardNo;
	}

	public Date getLastChargeTime() {
		return lastChargeTime;
	}

	public void setLastChargeTime(Date lastChargeTime) {
		this.lastChargeTime = lastChargeTime;
	}

	public Platform getPlatform() {
		return platform;
	}

	public void setPlatform(Platform platform) {
		this.platform = platform;
	}

	public Integer getFreeMinutes() {
		return freeMinutes;
	}

	public void setFreeMinutes(Integer freeMinutes) {
		this.freeMinutes = freeMinutes;
	}

	public Long getMemberId() {
		return memberId;
	}

	public void setMemberId(Long memberId) {
		this.memberId = memberId;
	}

	@Column(length = 64)
	public String getLotRecordId() {
		return lotRecordId;
	}

	public void setLotRecordId(String lotRecordId) {
		this.lotRecordId = lotRecordId;
	}

	/**
	 * 获取字符串形式的uniqueId 前端在接收long型的值时会自进位
	 */
	@Transient
	public String getStrUniqueId() {
		return uniqueId.toString();
	}

	public CarActType getCarActType() {
		return carActType;
	}

	public void setCarActType(CarActType carActType) {
		this.carActType = carActType;
	}

}
